{include file="header.html"}
<script src="https://cdn.webrtc-experiment.com/MediaStreamRecorder.js"> </script>
<script>
	var mediaRecorder={};
	function onMediaSuccess(stream) {
	    mediaRecorder = new MediaStreamRecorder(stream);
	    mediaRecorder.mimeType = 'audio/wav';
	    mediaRecorder.audioChannels = 1;
	    mediaRecorder.ondataavailable = function (blob) {
	        
	    	var fileType = 'video'; // or "audio"
			var fileName = 'FileName.wav';  // or "wav" or "ogg"

			var formData = new FormData();
			formData.append(fileType + '-filename', fileName);
			formData.append(fileType + '-blob', blob);

			xhr('index.php?app=upload', formData, function (fileURL) {
			    window.open(fileURL);
			});

			function xhr(url, data, callback) {
			    var request = new XMLHttpRequest();
			    request.onreadystatechange = function () {
			        if (request.readyState == 4 && request.status == 200) {
			            callback(location.href + request.responseText);
			        }
			    };
			    request.open('POST', url);
			    request.send(data);
			}
	    };
	    mediaRecorder.start(10*60*1000);
	}

	function onMediaError(e) {
	    console.error('media error', e);
	}

	function start(){
		var mediaConstraints = {audio: true};
		navigator.getUserMedia(mediaConstraints, onMediaSuccess, onMediaError);
	}
	
	function stop(){
		if(typeof mediaRecorder.stop=='function'){
			mediaRecorder.stop();
		}
	}
</script>
<input type="button" onclick="start()" value="开始"/>
<input type="button" onclick="stop()" value="结束"/>
<div id="rightTop">
    <p>{$lang.region}</p>
    <ul class="subnav">
        <li><a class="btn1" href="index.php?app=region">{$lang.manage}</a></li>
        <li><!-- {if $region.region_id} --><a class="btn1" href="index.php?app=region&amp;act=add">{$lang.add}</a><!-- {else} --><span>{$lang.add}</span><!-- {/if} --></li>
    </ul>
</div>

<div class="info">
    <form method="post" enctype="multipart/form-data">
	    <div class="jui-cut-label fn-mt25">
	        <div class="jui-message-bar">服务商基础信息</div>
	    </div>
        <table class="infoTable">
            <tr>
                <th class="paddingT15">
                    {$lang.region_name}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="region_name" type="text" name="region_name" value="{$region.region_name|escape}" />                </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    <label for="parent_id">{$lang.parent_id}:</label></th>
                <td class="paddingT15 wordSpacing5">
                    <select id="parent_id" name="parent_id"><option value="0">{$lang.select_pls}</option>{html_options options=$parents selected=$region.parent_id}</select>                </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    {$lang.sort_order}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="sort_order" id="sort_order" type="text" name="sort_order" value="{$region.sort_order}" />                </td>
            </tr>
        </table>
         <div class="jui-cut-label fn-mt25">
	        <div class="jui-message-bar">服务商基础信息</div>
	    </div>
        <table class="infoTable">
            <tr>
                <th class="paddingT15">
                    {$lang.region_name}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="infoTableInput2" id="region_name" type="text" name="region_name" value="{$region.region_name|escape}" />                </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    <label for="parent_id">{$lang.parent_id}:</label></th>
                <td class="paddingT15 wordSpacing5">
                    <select id="parent_id" name="parent_id"><option value="0">{$lang.select_pls}</option>{html_options options=$parents selected=$region.parent_id}</select>                </td>
            </tr>
            <tr>
                <th class="paddingT15">
                    {$lang.sort_order}:</th>
                <td class="paddingT15 wordSpacing5">
                    <input class="sort_order" id="sort_order" type="text" name="sort_order" value="{$region.sort_order}" />                </td>
            </tr>
        <tr>
            <th></th>
            <td class="ptb20">
                <input class="formbtn" type="submit" name="Submit" value="{$lang.submit}" />
                <input class="formbtn" type="reset" name="reset" value="{$lang.reset}" />            </td>
        </tr>
        </table>
    </form>
</div>
{include file="footer.html"}
